﻿@page "/transfers"
@inject IStringLocalizer<Transfers> Localizer

<h3>@Localizer["Title"]</h3>

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="" Name="Normal">
    <Transfer TValue="string" Items="@Items" OnSelectedItemsChanged="@OnSelectedItemsChanged" />
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>

<DemoBlock Title="@Localizer["CustomizableTitle"]" Introduction="@Localizer["CustomizableIntro"]" Name="Customer">
    <Transfer TValue="string" Items="@Items1"
              LeftPanelText="@Localizer["LeftPannelText"]" RightPanelText="@Localizer["RightPannelText"]"
              LeftButtonText="@Localizer["LeftButtonText"]" RightButtonText="@Localizer["RightButtonText"]" />
</DemoBlock>

<DemoBlock Title="@Localizer["SearchableTitle"]" Introduction="@Localizer["SearchableIntro"]" Name="Search">
    <Transfer TValue="string" Items="@Items2"
              LeftPanelText="@Localizer["LeftPannelText"]" RightPanelText="@Localizer["RightPannelText"]"
              LeftButtonText="@Localizer["LeftButtonText"]" RightButtonText="@Localizer["RightButtonText"]"
              LeftPannelSearchPlaceHolderString="@Localizer["PlaceHolder"]" RightPannelSearchPlaceHolderString="@Localizer["PlaceHolder"]"
              ShowSearch="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["BindToWayTitle"]" Introduction="@Localizer["BindToWayIntro"]" Name="Bind">
    <p>@((MarkupString)Localizer["BindToWayP1"].Value)</p>
    <Transfer Items="@Items3" @bind-Value="@SelectedValue" />
    <div class="my-3">Value：@string.Join(";", SelectedValue.Select(i => i.Text))</div>
    <Button Text="@Localizer["BindToWayButtonText1"]" OnClick="@OnAddItem" />
</DemoBlock>

<DemoBlock Title="@Localizer["ClientValidationTitle"]" Introduction="@Localizer["ClientValidationIntro"]" Name="Validate">
    <p>@((MarkupString)Localizer["ClientValidationP1"].Value)</p>
    <ValidateForm Model="@Model">
        <div class="row g-3">
            <div class="col-12">
                <Transfer Items="@Items5" @bind-Value="@Model.Hobby" />
            </div>
            <div class="col-12">
                <Button ButtonType="ButtonType.Submit">@Localizer["ClientValidationButtonText"]</Button>
            </div>
        </div>
    </ValidateForm>
    <div class="mt-3">Hobby: @string.Join(",", Model.Hobby)</div>
</DemoBlock>

<DemoBlock Title="@Localizer["DisableTitle"]" Introduction="@Localizer["DisableIntro"]" Name="Disable">
    <Transfer TValue="string" Items="@Items4" IsDisabled="true"
              LeftPanelText="@Localizer["LeftPannelText"]" RightPanelText="@Localizer["RightPannelText"]"
              LeftButtonText="@Localizer["LeftButtonText"]" RightButtonText="@Localizer["RightButtonText"]"
              LeftPannelSearchPlaceHolderString="@Localizer["PlaceHolder"]" RightPannelSearchPlaceHolderString="@Localizer["PlaceHolder"]"
              ShowSearch="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["ItemStyleTitle"]" Introduction="@Localizer["ItemStyleIntro"]" Name="ItemClass">
    <Transfer TValue="string" Items="@Items4" OnSetItemClass="SetItemClass" />
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />

<EventTable Items="@GetEvents()" />
